// import { SerialPort } from "serialport";

export async function scanSerialPorts() {
  try {
    const port = await navigator.serial.requestPort();
    const ports = await navigator.serial.getPorts();
    await port.open({ baudRate: 9600 });
    console.log(port);
    // 在这里可以进行与串行设备的通信
  } catch (error) {
    console.error(`Error scanning serial ports: ${error}`);
  }
}
